package com.shallwead.bna.Async;

import android.app.Activity;
import android.content.Context;
import android.os.AsyncTask;

import com.shallwead.bna.BnA;
import com.shallwead.bna.util.JSON;

public class GetBackAdAsync extends AsyncTask<String, String, Boolean> {

	Context mContext;

	public GetBackAdAsync(Context mContext) {
		this.mContext = mContext;
	}

	@Override
	protected Boolean doInBackground(String... params) {
		// try {
		// BnA.adBackList = JSON.getBackAdList();
		// return true;
		// } catch (Exception e) {
		// return false;
		// }

		if (BnA.adBackList.size() > 0) {
			return true;
		} else {
			return false;
		}

	}

	@Override
	protected void onPostExecute(Boolean result) {
		super.onPostExecute(result);
		if (BnA.adBackList.size() == 0)
			((Activity) mContext).finish();

		if (result && BnA.adBackList.size() > 0) {
			BnA.showBacktAd(mContext, BnA.adBackList);
		}
	}

}